package oneD.models;

import java.io.IOException;

import junit.framework.Assert;

import org.junit.Test;

public class TensegrityModelReaderTest {

	@Test
	public void testReadNextNode() {
		TensegrityModelReader r = new TensegrityModelReader(
				"C:/tviewer/x48prism1.dat");
		if (r.isReady()) {
			double[] d = null;
			do {
				try {
					d = r.readNextNode();
				} catch (IOException e) {
					System.out.println(e.toString());
				}
				System.out.println(d[0] + "," + d[1] + "," + d[2]);
			} while (d != null);
		}
		Assert.assertNotNull(r);
	}

	@Test
	public void testReadNextElement() {
		TensegrityModelReader r = new TensegrityModelReader(
				"C:/tviewer/x48prism1.dat");
		if (r.isReady()) {
			int[] i = null;
			do {
				try {
					i = r.readNextElement();
				} catch (IOException e) {
					System.out.println(e.toString());
				}
				System.out.println(i[0] + "," + i[1] + "," + i[2]);
			} while (i != null);
		}
		Assert.assertNotNull(r);
	}

}
